﻿using MemberPoint.Business;
using MMPS.Business;
using MMPS.Entity.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MPMCDC.Controllers
{
    public class ShopsController : Controller
    {
        /// <summary>
        /// 显示数据 分页 模糊查询
        /// </summary>
        /// <returns></returns>
        // GET: Shops
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult getShops(ShopsViewModel ShopsViewModel)
        {
            ShopsService _ShopsService = new ShopsService();
            var res = _ShopsService.GetShops(ShopsViewModel);
            return Json(res.Data);
        }
        /// <summary>
        /// 添加
        /// </summary>
        public ActionResult Add()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Add(GetPageShopsView AddShops)
        {
            ShopsAddService _shopsAddService = new ShopsAddService();
            var AddList = _shopsAddService.GetAddShops(AddShops);
            return Json(AddList);
        }
        /// <summary>
        /// 修改
        /// </summary>
        public ActionResult Edit(int id)
        {
            ShopsAddService _shopsAddService = new ShopsAddService();
            var list = _shopsAddService.Edit(id).Data;
            return View("Add",list);
        }
        [HttpPost]
        public ActionResult Edit(GetPageShopsView AddShops)
        {
            ShopsAddService _shopsAddService = new ShopsAddService();
            var AddList = _shopsAddService.Edit(AddShops);
            return Json(AddList);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <returns></returns>
        public ActionResult Delete(int S_ID)
        {
            ShopsAddService _shopsAddService = new ShopsAddService();
            var AddList = _shopsAddService.Delete(S_ID);
            return Json(AddList);
        }
    }
}